from peewee import CharField, DateTimeField, IntegerField

from application.db import get_database_connection
from application.db.mysql_db.base_mysql_model import BaseMysqlModel


class CnArticleKeywordsList(BaseMysqlModel):
    """中文文献库文献关键词列表"""
    list_id = None  # 覆盖基类的主键字段
    keyword_id = CharField(max_length=32)  # 关键词ID，cnky+入库时间(14位年月日时分秒+6位微秒)+6位随机数组成的30位字符串
    keyword_chs = CharField(max_length=255, index=True)  # 关键词中文表述，对于英文文献记录关键词中文译文
    keyword_eng = CharField(max_length=255, null=True, index=True)  # 关键词英文表述，对于中文文献可为空
    
    class Meta:
        table_name = 'cn_article_keywords_list'
        database = get_database_connection('default')  # 使用默认数据库

if __name__ == '__main__':
    data = CnArticleKeywordsList.select().dicts()
    for i in data:
        print(i)
        break